package Tool;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class MySQL_StaffDelete {
    public static void staffDelete(Connection conn, int id) throws SQLException {
        //定义sql

        //删除

        String sql = "delete from staffsystem.staff where id = ?";

        //获取执行psql的对象  PreparedStatement
        PreparedStatement pstmt = conn.prepareStatement(sql);

        //设置？的值
        pstmt.setInt(1, id);

        //执行sql语句
        pstmt.executeUpdate();

        //释放资源
        pstmt.close();

    }
}
